class ClasserService {

    boolean transactional = true

    def serviceMethod() {

    }
    // 班级升级，在blog方应该就是改名字而已
    def upClasserName(hostId,classerName) {
        log.info(hostId)
        def classerInstance = Classer.findByhostId(hostId.toLong())
        if(classerInstance){
            log.info(classerName)
            classerInstance.classesName = classerName
            classerInstance.name = classerName
            classerInstance.save(flush:true)            
             // // 更新班级站点的名字
            def siteInstance = Site.findByAuthor(classerInstance)
            if(siteInstance){
                siteInstance.title = classerName
                siteInstance.save(flush:true)
            }
        }
        return ['success':true,'message' : '']
    }
}
